import Mock from "mockjs";

// 示例模拟接口
Mock.mock("/api/data", "get", () => {
  return Mock.mock({
    "list|1-10": [
      {
        "id|+1": 1,
        name: "@cname",
        "age|18-60": 1,
      },
    ],
  });
});

// 登录模拟接口
Mock.mock("/api/login", "post", (options) => {
  const { username, password } = JSON.parse(options.body);
  if (username === "admin" && password === "123456") {
    return { code: 200, message: "登录成功", token: "111" };
  } else {
    return { code: 401, message: "用户名或密码错误" };
  }
});

// 可以继续添加其他模拟接口

export default Mock;
